package com.yzy.fly.controller;

import com.yzy.fly.domain.RestMessage;
import com.yzy.fly.kernel.controller.FlyConstant;
import com.yzy.fly.kernel.controller.FlyNoneController;
import com.yzy.fly.mapper.FlyClassMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Slf4j
@RestController
@RequestMapping("/api/search")
public class FlySearchEngineController extends FlyNoneController {
//    @Autowired
//    private FlyModelService flyModelService;
//    @Autowired
//    private FlyModelMapper flyModelMapper;
    @Autowired
    private FlyClassMapper flyClassMapper;
//    @Autowired
//    private FlyClassService flyClassService;

    @RequestMapping(value = "/all", method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
    @ResponseBody
    public RestMessage all(){
        long statTime = System.currentTimeMillis();
        List<Object> flyClasses = null;
//                List<FlyClass> flyClasses = flyClassMapper.selectAll();
        long endTime = System.currentTimeMillis();
        return RestMessage.success("查询成功",flyClasses,(endTime-statTime));
    }

    @Override
    public String getType() {
        return FlyConstant.FLY_CORE;
    }
}
